<template>
  <body>
  <div>
    <img src="../assets/img-login.jpg" class="pic">
    <div class="bian">
    <h1 class="title11">欢迎来到智慧家园</h1>
    <div>
      <form>
        <div class="class12">账号&nbsp; : &nbsp;<input id="input-text" type="text" class="text1" v-model="account">
        </div>
        <div class="class13">密码 &nbsp;: &nbsp;<input id="input-text" type="password" class="text1" v-model="password ">
        </div>
      </form>
      <div>
        <el-button type="primary" class="class14" @click="login">确认</el-button>
      </div>
    </div>
    </div>
  </div>
  </body>
</template>
<script>

import request from "@/utils/request";
import router from "@/router";

export default {
  name: "UserCheck",
  data() {
    return {
      imf: {
        name: '',
        account: '',
        telephone: '',
        place: '',
        password: '',
        status:''
      },
      account: '',
      password: ''
    }
  },
  methods: {
    login() {
      request.post("http://localhost:8082/user/rentlogin?account="+this.account+"&password="+this.password).then(res =>{
        if(res.flag){
          // localStorage.setItem("userToken",res.data)
          this.imf=res.data
          console.log('test',this.imf)
          router.push({path: '/userConfirm',query: { status: this.imf.status }});
          this.$message({
            type: 'success',
            message: res.msg
          })
        }else {
          this.$message.error(res.msg)
          this.account = ''
          this.password = ''
        }
      })
    },
    redirect() {
      router.push({path: '/regiest'});
    }
  }
}
</script>

<style>
.title11 {
  position: absolute;
  margin-left: 22%;
  top: 40px;
  color: #ffffff90;
}
#input-text{
  border-radius: 8px;
}
.class12 {
  /* display: inline-flex; */
  position: absolute;
  top: 150px;
  margin-left: 10%;
  text-align: center;
  font-family: fantasy;
}

.class13 {
  /* display: inline-flex; */
  position: absolute;
  top: 210px;
  margin-left: 10%;
  text-align: center;
  font-family: fantasy;

}
.class14 {
  position: absolute;
  margin-left: 23%;
  top: 300px;
  width: 260px;
  height: 35px;
  border-radius: 5px;
  font-size: 20px;
}

.class15 {
  position: absolute;
  margin-left: 39%;
  top: 460px;
  width: 260px;
  height: 35px;
  background-image: url(../assets/button-bg.jpg);
  border-radius: 5px;
  font-size: 20px;
}

.class6 {
  text-align: center;
}

.text1 {
  height: 25px;
  width: 300px;
}
.pic{
  position: absolute;
  width:auto;
  height:auto;
  max-width:100%;
  max-height:100%;
  z-index: -1;
}
.bian{
  position: absolute;
  margin-top: 10%;
  margin-left: 30%;
 width:  470px;
  height:400px;
  z-index: -1;
  box-shadow: 12px 12px 12px rgba(1,1,1,4);
  background-color: #99c8ea;
  border-radius: 20px;
}

</style>
